<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link href="__ADMIN__/css/style.css" rel="stylesheet" type="text/css" />
    <script language="JavaScript" src="__ADMIN__/js/jquery.js"></script>
</head>

<body>
    <div class="place">
        <span>位置：</span>
        <ul class="placeul">
            <li><a href="#">首页</a></li>
            <li><a href="#">表单</a></li>
        </ul>
    </div>
    <div class="formbody">
        <div class="formtitle"><span>基本信息</span></div>
        <form action="" method="post">
            <ul class="forminfo">
                <span>
                <li>
                    <label>上级分类</label>
                    <select class="dfinput sel" name="cate_pid">
                        <option value="0">--请选择--</option>
                        <foreach name="cateinfo" item="v" key="k">
                        <option value="{$v.cate_id}">{$v.cate_name}</option>
                        </foreach>
                    </select>
                </li>
              </span>
                <li>
                    <label>分类名称</label>
                    <input name="cate_name" placeholder="请输入分类名称" type="text" class="dfinput" />
                </li>
                <li>
                    <label>分类级别</label>
                    <input name="level" type="text" class="dfinput" readonly="readonly" value="1"/>
                </li>
                <li>
                    <label>&nbsp;</label>
                    <input  id="btnSubmit" type="button" class="btn btn-info" value="确认保存" />
                </li>
            </ul>
        </form>
    </div>
</body>
<script type="text/javascript">
//jQuery代码
$(function(){
    //给btnsubmit绑定点击事件
    $('#btnSubmit').live('click',function(){
        //表单提交
        $('form').submit();
    });

    $('.sel').live('change',function(){
      var _this = $(this);
      var pid =  $(this).val();
      var a =$(this).parent().find('~').remove();
      data = {
        pid:pid
      };
      $.post("{:U('cate/catechoose')}",data,function(msg){
        //alert(msg);
        if(msg.level){
          $("[name='level']").val(msg.level);
          _this.parent().after(msg.str);
        }
      },'json');
    });
});
</script>
</html>
